
using System;
using System.Collections.Generic;
using System.IO;
using Chronicle.Parser;

namespace Chronicle.Analyzation
{
	public class EventInformation
	{
		public string EventName { get; set; }
		public DateTime StartTime { get; set; }
		public DateTime EndTime { get; set; }
		public double TotalSeconds { get; set; }
		public Dictionary<string, Actor> Actors = new Dictionary<string, Actor> ();

		public Actor GetActor (Event evt)
		{
			Actor result;
			if (!Actors.TryGetValue(evt.ActorId, out result)) 
				Actors[evt.ActorId] = result = new Actor(evt.ActorId, evt.ActorName) {
				ActorType = evt.ActorType,
				FirstAction = evt.TimeStamp
			};
			return result;
		}

		public Actor GetTarget (Event evt)
		{
			Actor result;
			if (!Actors.TryGetValue(evt.TargetId, out result)) 
				Actors[evt.TargetId] = result = new Actor(evt.TargetId, evt.TargetName) {
				ActorType = evt.TargetType,
				FirstAction = evt.TimeStamp
			};
			return result;
		}
	}
}
